package com.weixin1.utils;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.serializer.SerializerFeature;

public class JSONUtil {

    public static String toString(Object o){
        JSON.DEFFAULT_DATE_FORMAT = "yyyy-MM-dd";
        return  JSON.toJSONString(o, SerializerFeature.WriteDateUseDateFormat,SerializerFeature.PrettyFormat);
    }


    public static String toString(Object o,String format){
        JSON.DEFFAULT_DATE_FORMAT = format;
        return  JSON.toJSONString(o, SerializerFeature.WriteDateUseDateFormat,SerializerFeature.PrettyFormat);
    }

}
